<template>
	<gui-page ref="guiPage" :customHeader="true">
		<!-- 导航 -->
		<template v-slot:gHeader>
			<nav-bar-custom left-icon="left" :title="$t('materials.rejectedMaterial')"></nav-bar-custom>
		</template>
		<template v-slot:gBody>
			<view v-if="scanList.length == 0" class="noticeHooks">
				{{ scanList.length == 0 ? $t('stockManage.notAvailable') : $t('stockManage.without') }}
			</view>
			<view class="record-card" v-for="(list, index) in scanList" :key="index" v-else>
				<view class="card-body">
					<uni-icons class="close-icons" type="closeempty" color="#9C9C9C" size="30"
						@click="deletList(index, list)"></uni-icons>
					<view class="card-mini-head">
						<view class="title-line"></view>
						<text>{{ $t('translationImage.serialNumber') }}：{{ scanList.length - index }}</text>
					</view>
					<view class="custom-card-itemOne">
						<text class="body-item-title">{{ $t('distributedEnter.materialCoded') }}：</text>{{ list.barCode }}
					</view>
					<view class="custom-card-itemOne">
						<text class="body-item-title">{{ $t('distributedEnter.materialCode') }}：</text>
						{{ list.materialCode }}
					</view>
					<view class="custom-card-itemOne">
						<text
							class="body-item-title">{{ $t('distributedEnter.materialName') }}：</text>{{ list.materialName }}
					</view>
					<view class="custom-card-itemOne">
						<text
							class="body-item-title">{{ $t('distributedEnter.materialSpec') }}：</text>{{ list.materialSpec }}
					</view>
					<view class="custom-card-itemOne">
						<text class="body-item-title">{{ $t('distributedEnter.uom') }}：</text>{{ list.returnUnit }}
					</view>
					<view class="custom-card-itemOne">
						<text class="body-item-title">{{ $t('distributedEnter.qty') }}：</text>{{ list.returnQty }}
					</view>
					<view class="custom-card-itemOne">
						<text
							class="body-item-title">{{ $t('distributedOut.warehouse') }}：</text>{{ list.sourceWarehouseCode }}
					</view>
					<view class="custom-card-itemOne">
						<text class="body-item-title">{{ $t('distributedOut.location') }}：</text>{{ list.locationName }}
					</view>
				</view>
			</view>
		</template>
	</gui-page>
</template>

<script setup>
// 引入文件
import { computed, onMounted } from 'vue';
import { useStore } from "vuex";
import { basPdaOperationLogFn } from '@/utils/index.js';
import { OPERATION_DEL, OPERATION_LOOK } from '@/constant/index.js'

// 定义vuex的变量获取数据
let store = useStore();
// 通过计算属性获取数据
const scanList = computed(() => {
	console.log(store.state.forLabelingMaterialList, 'data.scanInfo')
	return store.state.forLabelingMaterialList
})
onMounted(() => {
	try {
		let inputParameter = '无'
		let returnParameter = JSON.stringify(data.scanList)
		let operationPicture = '退料记录'
		let callInterface = '无'
		let opertionParmes = {
			inputParameter,
			returnParameter,
			operationPicture,
			callInterface,
			responseCode: '无',//返回状态
			errorMessage: '无',//错误信息
			isPass: 'Y',//是否成功 Y N
			operationType: OPERATION_LOOK,
			module: 'WMS',
			source: "PDA",
		}
		basPdaOperationLogFn(opertionParmes)
	} catch (error) {
		console.log('error')
	}
	
})
// 删除 (先在vuex定义方法,在使用)
const deletList = (index, item) => {
	try {
		let inputParameter = JSON.stringify(item)
		let returnParameter = '无'
		let operationPicture = '来料入库'
		let callInterface = '无'
		let opertionParmes = {
			inputParameter,
			returnParameter,
			operationPicture,
			callInterface,
			responseCode: '无',//返回状态
			errorMessage: '无',//错误信息
			isPass: 'Y',//是否成功 Y N
			operationType: OPERATION_DEL
		}
		basPdaOperationLogFn(opertionParmes)
	} catch (error) {
	}
	store.commit("deleteforLabelingMaterialList", index)
}
</script>

<style></style>
